//
//  WD_HomeGroupTableViewCell.m
//  BUDING
//
//  Created by HanWoonYong on 16/3/31.
//  Copyright © 2016年 HanWoonYong. All rights reserved.
//

#import "WD_HomeGroupTableViewCell.h"

@implementation WD_HomeGroupTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.picture = [[UIImageView alloc] initWithFrame:CGRectZero];
        [self.contentView addSubview:self.picture];
        
        self.title = [[UILabel alloc] initWithFrame:CGRectZero];
        [self.contentView addSubview:self.title];
        
        self.message = [[UILabel alloc] initWithFrame:CGRectZero];
        self.message.numberOfLines = 3;
        [self.contentView addSubview:self.message];
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.picture.frame = CGRectMake(0, 0, WIDTH, 150);
    self.title.frame = CGRectMake(0, self.picture.frame.size.height, WIDTH, 30);
    self.message.frame = CGRectMake(0, self.picture.frame.size.height + 30, WIDTH, 50);
}

- (void)setGroupModel:(WD_GroupModel *)groupModel {
    _groupModel = groupModel;
    [self.picture sd_setImageWithURL:[NSURL URLWithString:_groupModel.cover]];
    self.title.text = _groupModel.title;
    self.message.text = _groupModel.desc;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
